A API enhancement for getting the ip and port for current connected server. Closes #1750.#1764
Open
qyl27 wants to merge 2 commits intoPaperMC:dev/3.0.0from
Open
A API enhancement for getting the ip and port for current connected server. Closes #1750.#1764qyl27 wants to merge 2 commits intoPaperMC:dev/3.0.0from
qyl27 wants to merge 2 commits intoPaperMC:dev/3.0.0from
Conversation
…erver. Closes PaperMC#1750. Signed-off-by: 秋雨落 <i@rain.cx>
There was a problem hiding this comment.
Pull request overview
Adds an API to expose the resolved (actually connected) backend server address (IP/port) for a ServerConnection, addressing cases where configured ServerInfo#getAddress() may remain unresolved when a hostname is used.
Changes:
- Added
ServerConnection#getConnectedServerInfo()to expose connected/resolved server address details. - Implemented tracking of the connected server’s resolved
ServerInfoinsideVelocityServerConnectionduring backend connect, and cleared it on disconnect.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| api/src/main/java/com/velocitypowered/api/proxy/ServerConnection.java | Adds new API method getConnectedServerInfo() for exposing the resolved/connected server info. |
| proxy/src/main/java/com/velocitypowered/proxy/connection/backend/VelocityServerConnection.java | Stores connected server resolved address from Netty channel remote address and exposes it via the new API method. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
api/src/main/java/com/velocitypowered/api/proxy/ServerConnection.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an api enhancement of the use case mentioned in #1750. It adds a
getConnectedServerInfofor getting the current connected IP and port.If I have a backend server with
some-dynamic-host-name:25565, it will be resolved inVelocityServerConnection#connect, but the resolution result (as the server player really connects to) cannot be gotten by the API; I got an unsolvedInetSocketAddressinstead.It assumes
future.channel().remoteAddress()will return anInetSocketAddressbecause it was up-cast from it inBootstrap#connect(SocketAddress).